package com.github.easyms.common.constant;

import java.util.Arrays;
import java.util.List;

/**
 * @author Leo.Liao
 * 全局常量
 * @date 2020-04-08 23:51:17
 */
public class GlobalConstants {

    /**
     * JWT常量
     */
    public static class SecurityKey{
        /**
         * JWT-account
         */
        public static final String USER = "user";

        /**
         * JWT-role
         */
        public static final String ROLE = "role";

        /**
         * JWT-currentTimeMillis
         */
        public final static String CURRENT_TIME_MILLIS = "currentTimeMillis";
    }

    /**
     * 请求/响应字段
     */
    public static class Fields {


    }

    /**
     * 数据状态
     */
    public static class DataStatus {

        // 正常
        public static final String ACTIVE = "ACTIVE";
        // 锁定
        public static final String LOCKED = "LOCKED";

    }

    // ==================================== 系统通用请求URL Start ===================================================================

    /**
     * 请求路由
     */
    public static class Url {

        // 分页查询
        public static final String LIST = "/list";
        // 插入
        public static final String INSERT = "/insert";
        // 更新
        public static final String UPDATE = "/update";
        // 删除
        public static final String DELETE = "/delete";
        // 查询下拉列表
        public static final String LIST_COMBOBOX = "/listCombobox";
        // 查询所有数据（不分页）
        public static final String LIST_ALL = "/listAll";
        // 查询一条数据
        public static final String GET_ONE = "/getOne";

    }

    public static class Settings{

        /**
         * 系统支持的语言，zh_CN:简体中文；zh_TW:繁体中文；en:英文
         */
        public static final List<String> ACCEPT_LANGUAGE = Arrays.asList("zh_CN","zh_TW","en");

        /**
         * 密码格式（以字母开头，长度在6~18之间，只能包含字母、数字和下划线）
         */
        public static final String PWD_FORMAT = "^[a-zA-Z]\\w{5,17}$";

        /**
         * 用户名格式（字母开头，允许5-16字节，允许字母数字下划线）
         */
        public static final String ACCOUNT_FORMAT = "^[a-zA-Z][a-zA-Z0-9_]{4,15}$";

        /**
         * 系统保留用户
         */
        private static final String DEFAULT_USER = "admin";
        /**
         * 系统保留用户组
         */
        private static final String DEFAULT_ROLE = "Administrator";
        /**
         * 系统保留菜单
         */
        private static final String ROOT_MENU = "root";
    }

    /**
     * 其它常量
     */
    public static class OtherConst{

        /**
         * 逗号分隔符
         */
        public static final String GNU_SED = ",";

        /**
         * 正序
         */
        public static final String ASC = "asc";
        /**
         * 倒序
         */
        public static final String DESC = "desc";

    }

    /**
     * 时间
     */
    public static class TimeParams {

        // ============================== 单位：秒
        // 10 秒
        public static final Long TEN_SEC = 10L;
        // 30 秒
        public static final Long THIRTY_SEC = 30L;
        // 1 分钟
        public static final Long ONE_MINUTE_SEC = 60L;
        // 1 小时
        public static final Long ONE_HOUR_SEC = 60 * 60L;
        // 12 小时
        public static final Long TWELVE_HOUR_SEC = 60 * 60 * 12L;
        // 24 小时
        public static final Long ONE_DAY_SEC = 60 * 60 * 24L;

        // ================================ 单位：毫秒
        // 24 小时
        public static final Long ONE_DAY_MILLIS = new Long(60 * 60 * 24 * 1000L);
        //1 小时
        public static final Long HOUR = new Long(60 *60 *1000L);
        //1 分钟
        public static final Long MIN = new Long(60 *1000L);

    }

}
